﻿using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace Matchingo.Modules.FlyoutEffectsModule.Views
{
    public partial class FlyoutEffectsView : UserControl, IFlyoutEffectsView
    {
        #region ========== Private Properties ==========

        private FlyoutEffectsViewModel ViewModel { get; set; }

        #endregion

        #region ========== Constructor ==========

        public FlyoutEffectsView()
        {
            InitializeComponent();
        }

        #endregion

        #region ========== Public Methods ==========

        public void Initialize(FlyoutEffectsViewModel viewModel)
        {
            ViewModel = viewModel;
            DataContext = ViewModel;
        }

        public void FireComboFlyout(int comboCount)
        {
            switch (comboCount)
            {
                case 2:
                    SetComboText("Double Combo!");
                    break;
                case 3:
                    SetComboText("Triple Combo!");
                    break;
                case 4:
                    SetComboText("Quad Combo!!!");
                    break;
                case 5:
                    SetComboText("5X Combo!!!!!");
                    break;
                case 6:
                    SetComboText("6X Combo!!!!!");
                    break;
                case 7:
                    SetComboText("7X Combo!!!!!");
                    break;
                case 8:
                    SetComboText("8X Combo!!!!!");
                    break;
                default:
                    SetComboText("Crazy Combo!!");
                    break;
            }

            Storyboard sb = (Storyboard)Resources["RoundFlyout"];
            sb.Begin();
        }

        #endregion

        #region ========== Private Methods ==========

        private void SetComboText(string text)
        {
            string textPadded = text.PadRight(12);

            Double_D.Text = textPadded[0].ToString();
            Double_o.Text = textPadded[1].ToString();
            Double_u.Text = textPadded[2].ToString();
            Double_b.Text = textPadded[3].ToString();
            Double_l.Text = textPadded[4].ToString();
            Double_e.Text = textPadded[5].ToString();
            Double_X.Text = textPadded[6].ToString();
            Combo_C.Text = textPadded[7].ToString();
            Combo_o.Text = textPadded[8].ToString();
            Combo_m.Text = textPadded[9].ToString();
            Combo_b.Text = textPadded[10].ToString();
            Combo_o2.Text = textPadded[11].ToString();
        }

        #endregion

    }
}
